<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/echarts/map/js/china.js?v=1598903772045"></script>


    <script type="text/javascript">


        $(function () {//页面加载结束

            var myChart = echarts.init(document.getElementById('main'));

            var option = {
                tooltip: {
                    formatter: function (params, ticket, callback) {
                        return params.seriesName + '<br />' + params.name + '：' + params.value
                    }
                },

                visualMap: {
                    min: 0,
                    max: 1500,
                    left: 'left',
                    top: 'bottom',
                    text: ['高', '低'],
                    inRange: {
                        color: ['#e5e0e0', '#490104']
                    },
                    show: true
                },
                geo: {
                    map: 'china',
                    roam: false,
                    zoom: 1.23,
                    label: {
                        normal: {
                            show: true,
                            fontSize: '10',
                            color: 'rgba(0,0,0,0.7)'
                        }
                    },
                    itemStyle: {
                        normal: {
                            borderColor: 'rgba(0, 0, 0, 0.2)'
                        },
                        emphasis: {
                            areaColor: '#F3B329',
                            shadowOffsetX: 0,
                            shadowOffsetY: 0,
                            shadowBlur: 20,
                            borderWidth: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                },

                series: [
                    {
                        name: '民事案件',
                        type: 'map',
                        geoIndex: 0,
                        data: [],
                    }

                ]
            };

            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(option);

            //发送请求
            var  url = "http://localhost:8080/project1/test3"
            var paramter = ""
            var func =function(data){

                for (var i =0;i < data.length;i++){
                    option.series[0].data.push({
                        "value": data[i].nums, "name": data[i].name
                    })
                }
                myChart.setOption(option);
            }
            var type="json"
            $.get(url,paramter,func,type);

        })
    </script>
</head>
<body>

    <div id="main" style="width: 1000px;height:700px; position: absolute;top: 10%;left: 20%;margin: -50px 0 0 -50px" ></div>
</body>
</html>